using System;
using Microsoft.SPOT;
using S = SecretLabs.NETMF.Hardware;
using Microsoft.SPOT.Hardware;

namespace Netduino4Fun.Framework.ElectronicBrick
{
    public class TemperatureSensor
    {
        const double a = 0.0491837588949351;
        const double b = -14.26823984930932;

        S.AnalogInput input;

        public TemperatureSensor(Cpu.Pin pin)
        {
            this.input = new S.AnalogInput(pin);
        }

        public double Temperature
        {
            get
            {
                int value = this.input.Read();
                return a * value + b;
            }
        }
    }
}
